package com.rongzhe.house.ui.activity;

import android.os.Bundle;
import android.support.annotation.Nullable;

import com.rongzhe.house.R;
import com.rongzhe.house.entity.voo.HouseOverview;
import com.rongzhe.house.presenter.PageContoller;
import com.rongzhe.house.presenter.RentTypePresenter;
import com.rongzhe.house.ui.adapter.HouseAdapter;
import com.rongzhe.house.ui.view.smoothlist.SmoothListView;

import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * Created by huang on 2017/12/5.
 */

public class RentTypeActivity extends BaseActivity<RentTypePresenter>
        implements PageContoller.PageControlInteface<HouseOverview>{
    public static final String EXTRA_TITLE = "extra_title";
    @BindView(R.id.house_info)
    SmoothListView houseInfoList;
    private HouseAdapter mAdapter;


    @Override
    protected RentTypePresenter createPresenter() {
        return new RentTypePresenter(this);
    }

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_rent_type_house);
        ButterKnife.bind(this);
        mAdapter = new HouseAdapter(this);
        houseInfoList.setAdapter(mAdapter);
    }

    @Override
    public void addData(List<HouseOverview> houseInfos) {
        mAdapter.addHouseInfos(houseInfos);
    }

    @Override
    public void setData(List<HouseOverview> houseInfos) {
        mAdapter.setHouseInfos(houseInfos);
    }

    @Override
    public void loadData(boolean append) {
        mPresenter.loadData(append);
    }

    @Override
    public SmoothListView getListView() {
        return houseInfoList;
    }

    @Override
    public void setAsNoData(boolean noData) {

    }

    @Override
    protected String getActionTitle() {
        return getIntent().getStringExtra(EXTRA_TITLE) + getString(R.string.house_source);
    }
}
